/*
Read DeLorme drawing files (.an1)
-
+
Copyright (C) 2005 Ron Parker and Robert Lipe.
This program is free software; you can redistribute it and/or modify
long lineweight;
long linestyle;
long linecolor;
- long unk5;
+ long opacity;
long polyfillcolor;
long unk6;
long unk7;
line->lineweight = ReadShort( f );
line->linestyle = ReadLong( f );
line->linecolor = ReadLong( f );
- line->unk5 = ReadLong( f );
+ line->opacity = ReadLong( f );
line->polyfillcolor = ReadLong( f );
line->unk6 = ReadLong( f );
line->unk7 = ReadLong( f );
WriteShort( f, (short) line->lineweight );
WriteLong( f, line->linestyle );
WriteLong( f, line->linecolor );
- WriteLong( f, line->unk5 );
+ WriteLong( f, line->opacity );
WriteLong( f, line->polyfillcolor );
WriteLong( f, line->unk6 );
WriteLong( f, line->unk7 );
Read_AN1_Line( f, rec );
/* create route rec */
rte_head = route_head_alloc();
+ rte_head->line_color.bbggrr = rec->linecolor;
+ if (rec->opacity == 0x8200)
+ rte_head->line_color.opacity = 128;
+ // lineweight isn't set for dashed/dotted lines
+ // Since we don't have a way to represent this internally yet,
+ // use leave line_width at the default.
+ if(rec->lineweight)
+ rte_head->line_width = rec->lineweight;
+ rte_head->rte_name = xstrdup(rec->name);
fs_chain_add( &rte_head->fs, (format_specific_data *)rec );
route_add_head(rte_head);
for (j = 0; j < (unsigned) rec->pointcount; j++ ) {
fs = fs_chain_find( rte->fs, FS_AN1L );
if ( fs ) {
- rec = (an1_line_record *)(void *)fs;
+ rec = (an1_line_record *)(void *)fs;
local = 0;
switch (output_type_num) {
case 1:
rec->unk4 = 2;
rec->lineweight = 6;
rec->linecolor = opt_color_num; /* red */
- rec->unk5 = 3;
+ rec->opacity = 3;
rec->unk8 = 2;
break;
}
fs_convert convert;
} format_specific_data;
+typedef struct {
+ int bbggrr; // 32 bit color: Blue/Green/Red. < 0 == unknown.
+ unsigned char opacity; // 0 == transparent. 255 == opaque.
+} gb_color;
+
+
format_specific_data *fs_chain_copy( format_specific_data *source );
void fs_chain_destroy( format_specific_data *chain );
format_specific_data *fs_chain_find( format_specific_data *chain, long type );
int rte_waypt_ct; /* # waypoints in waypoint list */
format_specific_data *fs;
unsigned short cet_converted; /* strings are converted to UTF8; interesting only for input */
+ gb_color line_color; /* Optional line color for rendering */
+ int line_width; /* in pixels (sigh). < 0 is unknown. */
} route_head;
/*
kml_write_xml(1, "<Placemark>\n");
kml_write_xml(0, "<name>Path</name>\n");
kml_write_xml(0, "<styleUrl>#lineStyle</styleUrl>\n");
+ if (header->line_color.bbggrr >= 0 || header->line_width >= 0) {
+ kml_write_xml(1, "<Style>\n");
+ kml_write_xml(1, "<LineStyle>\n");
+ if (header->line_color.bbggrr >= 0)
+ kml_write_xml(0, "<color>%02x%06x</color>\n",
+ header->line_color.opacity, header->line_color.bbggrr);
+ if (header->line_width >= 0)
+ kml_write_xml(0, "<width>%d</width>\n",header->line_width);
+ kml_write_xml(-1, "</LineStyle>\n");
+ kml_write_xml(-1, "</Style>\n");
+ }
kml_write_xml(1, "<LineString>\n");
if (floating) {
kml_write_xml(0, "<altitudeMode>absolute</altitudeMode>\n");